package com.gec.news.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gec.news.entity.Users;
import com.gec.news.mapper.UsersMapper;
import com.gec.news.service.UserService;
import org.springframework.stereotype.Service;

@Service
public class UsersServiceImpl extends ServiceImpl<UsersMapper , Users> implements UserService {
    @Override
    public Users login(String username,String paasword){
        //这里的查询采用mybatis plus 的条件查询 利用queryWrapper类封装查询条件
        QueryWrapper<Users> wrapper = new QueryWrapper<>();
        //wrapper就是封装查询条件
        //select * from news_users where uname = 'admin' and 'upwd' = '123456'
        //下面这两句话就是等于where uname = 'admin' and upwd = '123456'
        wrapper.eq("uname",username);
        wrapper.eq("upwd",paasword);
        Users users = baseMapper.selectOne(wrapper);
        return users;
    }
}
